

// import axios from "axios";

import instance from "./haeder";

const request = class {
    constructor(url, arg) {
        this.url = url
        this.arg = arg
    }

    // post 请求
    POST() {
        return new Promise((resolve, reject) => {
            instance.post(this.url,this.arg)
            .then((result) => {
                resolve(result)
            }).catch((err) => {
                reject(err)
            });
        })
    }

    // get 请求
    GET(){
        return new Promise((resolve, reject) => {
            instance.get((this.url))
            .then((result) => {
                resolve(result)
            }).catch((err) => {
                reject(err)
            });
        })
    }
}

export default request